package com.starlight.ts_clouddev.infrastructure.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 
 * @TableName cloud_instance
 */
@TableName(value ="cloud_instance")
@Data
public class CloudInstance implements Serializable {
    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 
     */
    private Date created;

    /**
     * 
     */
    private Date modified;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 镜像id
     */
    private Long mirrorId;

    /**
     * 类型
     */
    private String type;

    /**
     * 虚拟机名称
     */
    private String name;

    /**
     * cpu核
     */
    private Long cpu;

    /**
     * 内存
     */
    private Long memory;

    /**
     * 存储
     */
    private Long storage;

    /**
     * 本地ip
     */
    private String localIp;

    /**
     * 公网ip
     */
    private String publicIp;

    /**
     * 带宽
     */
    private Long bandwidth;

    /**
     * 期限
     */
    private Date deadline;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CloudInstance other = (CloudInstance) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCreated() == null ? other.getCreated() == null : this.getCreated().equals(other.getCreated()))
            && (this.getModified() == null ? other.getModified() == null : this.getModified().equals(other.getModified()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getMirrorId() == null ? other.getMirrorId() == null : this.getMirrorId().equals(other.getMirrorId()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getCpu() == null ? other.getCpu() == null : this.getCpu().equals(other.getCpu()))
            && (this.getMemory() == null ? other.getMemory() == null : this.getMemory().equals(other.getMemory()))
            && (this.getStorage() == null ? other.getStorage() == null : this.getStorage().equals(other.getStorage()))
            && (this.getLocalIp() == null ? other.getLocalIp() == null : this.getLocalIp().equals(other.getLocalIp()))
            && (this.getPublicIp() == null ? other.getPublicIp() == null : this.getPublicIp().equals(other.getPublicIp()))
            && (this.getBandwidth() == null ? other.getBandwidth() == null : this.getBandwidth().equals(other.getBandwidth()))
            && (this.getDeadline() == null ? other.getDeadline() == null : this.getDeadline().equals(other.getDeadline()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCreated() == null) ? 0 : getCreated().hashCode());
        result = prime * result + ((getModified() == null) ? 0 : getModified().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getMirrorId() == null) ? 0 : getMirrorId().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getCpu() == null) ? 0 : getCpu().hashCode());
        result = prime * result + ((getMemory() == null) ? 0 : getMemory().hashCode());
        result = prime * result + ((getStorage() == null) ? 0 : getStorage().hashCode());
        result = prime * result + ((getLocalIp() == null) ? 0 : getLocalIp().hashCode());
        result = prime * result + ((getPublicIp() == null) ? 0 : getPublicIp().hashCode());
        result = prime * result + ((getBandwidth() == null) ? 0 : getBandwidth().hashCode());
        result = prime * result + ((getDeadline() == null) ? 0 : getDeadline().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", created=").append(created);
        sb.append(", modified=").append(modified);
        sb.append(", userId=").append(userId);
        sb.append(", mirrorId=").append(mirrorId);
        sb.append(", type=").append(type);
        sb.append(", name=").append(name);
        sb.append(", cpu=").append(cpu);
        sb.append(", memory=").append(memory);
        sb.append(", storage=").append(storage);
        sb.append(", localIp=").append(localIp);
        sb.append(", publicIp=").append(publicIp);
        sb.append(", bandwidth=").append(bandwidth);
        sb.append(", deadline=").append(deadline);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}